home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / COM / LineShare 3.3.1 folder.sit / LineShare 3.3.1 folder / LineShare 3.3.1 / LineShare Scripts / Generic ARA&Hermes < prev    next >
Text File  |  1994-01-11  |  6KB  |  303 lines

  1. !$ Version 2.1
  2. !$ Requires: any modem
  3.  
  4. !$ Supports: ARA and a Hermes BBS software.
  5.  
  6. !$ Use:  ARA/LineShare for ARA.
  7.  
  8. !$ Read:  your modem manual to modify the "AT" strings.
  9.  
  10. !$ See:   the Generic Scripts Guide for details.
  11.  
  12. ^2 Speaker On:        = Enum("Never" = "0" ,  "When Connecting" = "1", "Always"="2") "1"
  13. ^3 Speaker Volume:    = Enum("Low"="1","Medium"="2","High"="3") "2"
  14. ^4 Answer On:         = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
  15. ^5 Adjust Port Speed: = Bool("Yes"="1","No"="0") "0"
  16. ^6 AT for Receive:    = Text ""
  17. ^7 AT for ARA calls:  = Text ""
  18. ^8 Max Port Speed:    = Enum("2400","9600","19200","38400") "9600"
  19.  
  20. ! ------------------------------------------
  21. ! Resetting the modem:
  22. ! ------------------------------------------
  23. @Hangup
  24.   SetTries 2
  25.   Flush
  26.   HsReset 0,0,17,19,0,0
  27. !
  28. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  29. ! to enter the command mode
  30. !
  31. @Label 1
  32.   matchclr
  33.   matchstr 1 2 "OK¥r¥n"
  34.   write "ATH0&FV1¥r"
  35.   matchread 20
  36.   Write "+++"
  37.   DtrClear
  38.   pause 10
  39.   DtrSet
  40. !
  41.   DecTries
  42.   IfTries 0 1
  43. !
  44. ! OSErr -6019 "Modem error - the modem is not responding"
  45. !
  46.   exit -6019
  47. @Label 2
  48.   exit 0
  49. ! ------------------------------------------
  50. !    Receiving incoming calls
  51. ! ------------------------------------------
  52. @ANSWER
  53.   SetVar A ""
  54.   IfStr A 50 "^6^7"
  55. @Label 10
  56.   SerReset Val("^8"),0,8,1
  57.   Jsr 80
  58. !
  59. ! Set the common options
  60.   Jsr 70
  61. !
  62. ! Set the communication options:
  63. ! ・ ^6 for receive mode (disable MNP), <DCE Speed>/ARQ message, hw flow control
  64.   Write "AT^6¥r"
  65.   Jsr 100
  66. !
  67. ! Tell the modem to determine the type of the incoming call
  68. ! Fetch the tube after ^4 rings
  69. !
  70.   Write "ATS0=^4¥r"
  71.   Jsr 100
  72.   Note "Waiting for ARA/BBS callsノ"
  73. !
  74. ! Everything is ready - let's sit and wait for a call
  75. ! We'll wait for 3 minutes, then reinitiate the modem
  76. !
  77. @Label 12
  78.   MatchClr
  79.   matchstr 1 13 "RING¥r¥n"
  80.   matchstr 2 21 "¥r¥nCONNECT ^$/"
  81.   matchstr 3 15 "¥r¥nCONNECT ^$¥r¥n"
  82.   matchstr 10 10 "¥r¥nNO "
  83.   matchstr 11 10 "¥r¥nBUSY"
  84.   Matchread 1800
  85.   Jump 10
  86. @Label 13
  87.   Note "Ringノ"
  88.   Jump 12
  89. !
  90. ! Data connection has been established (we read "CONNECT XXX¥r¥n")
  91. ! Put the "CONNECT" back to the buffer and attach the "Data" subPort
  92. ! if it was an incoming call, put the "RING" before the "CONNECT"
  93. !
  94. @Label 15
  95.   SetVar A "^$"
  96.   Note "Non-V.42 Call at ^A bps. Waiting for an ARA frame."
  97.   MatchClr
  98.   MatchStr 1 20 "¥r"
  99.   MatchStr 2 30 "¥08¥01¥03¥14¥04¥03¥00¥08¥250¥16¥03"
  100.   MatchRead 40
  101.  
  102. @Label 20
  103.   Note "Non-ARA call"
  104.   Jump 24
  105. !
  106. ! V.42 call detected
  107. !
  108. @Label 21
  109.   SetVar A "^$"
  110.   Note "V.42 Call at ^A bps"
  111.   MatchClr
  112.   MatchStr 1 24 "¥r¥n"
  113.   MatchRead 5
  114. @Label 24
  115.   Jsr 110
  116.   QueueInput "^B¥r"
  117. @Label 25
  118.   Attach "Hermes" (DTR,Escape,IdleLimit=200)
  119.  
  120. !
  121. ! The ARA (MNP 4) frame detected
  122. !
  123. @Label 30
  124.   Note "ARA call at ^A bps."
  125.   Flush
  126.   QueueInput " ^A¥r¥n"
  127. @Label 31
  128.   ifStr 5 32 "1"
  129.   QueueInput "¥r¥nCARRIER "
  130.   Jump 35
  131. @Label 32
  132.   QueueInput "¥r¥nCONNECT "
  133. @Label 35
  134.   ifOriginate 36
  135.   QueueInput "¥r¥nRING¥r¥n"
  136. @Label 36
  137.   Attach "ARA" (DTR,Escape,TimeLimit=0)
  138.  
  139. @Label 50
  140.   Note "Suspended"
  141.   Say "Press the Option button to enter the AT-strings for your modem!"
  142.   Pause 1200
  143.   Jump 50
  144.  
  145. ! ------------------------------------------
  146. ! Originating a call through the "ARA" subport
  147. ! ------------------------------------------
  148. @ORIGINATE "ARA"
  149.   SerReset Val("^8"),0,8,1
  150.   Jsr 80
  151. !
  152. ! Set the common options
  153. !
  154.   Jsr 70
  155. !
  156. ! Set the Data mode:
  157. ! ・ ^7  For ARA calls
  158. ! ・ハS7:  time-out (90 sec) for long-distance call (if you use them)
  159. !
  160.   Write "AT^7S7=90¥r"
  161.   Jsr 100
  162. !
  163. ! Prepare to receive all error result codes
  164. !
  165.   Jsr 90
  166.   MatchStr 1 31 "¥r¥nCONNECT"
  167.   MatchRead 900
  168.   Write "¥r"
  169.   Exit -6019
  170.  
  171. ! ------------------------------------------
  172. ! Originating a call through the "Data" subport
  173. ! ------------------------------------------
  174. @ORIGINATE "Hermes"
  175.   SerReset Val("^8"),0,8,1
  176.   Jsr 80
  177.   Jsr 70
  178. !
  179. ! Now emit all commands that the application has sent to that port
  180. !
  181.   Jsr 60
  182.   SerReset *
  183.   Jsr 80
  184. !
  185. ! Prepare to receive all error result codes
  186. !
  187.   Flush
  188.   Jsr 90
  189.   MatchStr 1 48 "^$¥r¥nCONNECT"
  190.   MatchRead 900
  191.   Write "¥r"
  192.   Exit -6019
  193. @Label 48
  194.   QueueInput "^$¥r¥nCONNECT"
  195.   Jump 25
  196.  
  197. !
  198. ! This section emits all modem commands sent from the client application
  199. ! For each set of commands the "OK" answer is awaited
  200. !
  201. @Label 60
  202.   EmitStart
  203. @Label 61
  204.   EmitCommand 62
  205.   Jsr 100
  206.   Jump 61
  207. @Label 62
  208.   return
  209. !
  210. ! This section initiates the modem before ANSWER and ORIGINATEs:
  211. ! dialtone detect + connect at the highest rate + speaker control +
  212. ! hang up on Dtr drop + DCD valid
  213. ! Verbal responses mode, no echo
  214. ! Disable extended codes
  215. !
  216. @Label 70
  217.   Write "ATX4M^2L^3&D2&C1V1E0¥r"
  218.   Jsr 100
  219.   return 
  220. !
  221. ! This section syncronize the modem after the serial port speed switching
  222. !
  223. @Label 80
  224.   ChrDelay 1
  225.   Write "AT¥r"
  226.   ChrDelay 0
  227.   Jsr 100
  228.   return
  229. !
  230. ! Prepare to receive error result codes
  231. !
  232. @Label 90
  233.   MatchClr
  234.   MatchStr 2 91 "NO DIALTONE¥r¥n"
  235.   MatchStr 3 92 "BUSY¥r¥n"
  236.   MatchStr 4 93 "NO CARRIER¥r¥n"
  237.   MatchStr 5 94 "NO ANSWER¥r¥n"
  238.   Write "ATD^1¥r"
  239.   HsReset *
  240.   return
  241.  
  242. @Label 91
  243.   exit -6020
  244. @Label 92
  245.   exit -6022
  246. @Label 93
  247.   exit -6021
  248. @Label 94
  249.   exit -6023
  250. !
  251. ! Processing the AT command:
  252. ! OK -> proceed
  253. ! ERROR or TimeOut ->exit -6019
  254. ! It can be called AFTER the "Write" command, since LineShare buffers input
  255. !
  256. @Label 100
  257.   MatchClr
  258.   MatchStr 1 102 "¥r¥nOK¥r¥n"
  259.   MatchStr 2 101 "¥r¥nERROR¥r¥n"
  260.   MatchRead 20
  261. @Label 101
  262.   Exit -6019
  263. @Label 102
  264.   return
  265. !
  266. ! Converting speed strings -> numbers
  267. !
  268. @Label 110
  269.   SetVar B "12"
  270.   IfStr A 111 "1200"
  271.   IfStr A 112 "2400"
  272.   IfStr A 113 "4800"
  273.   IfStr A 114 "9600"
  274.   IfStr A 115 "12000"
  275.   IfStr A 116 "14400"
  276.   IfStr A 117 "19200"
  277.   IfStr A 118 "38400"
  278.   return
  279. @Label 111
  280.   SetVar B "5"
  281.   return
  282. @Label 112
  283.   SetVar B "10"
  284.   return
  285. @Label 113
  286.   SetVar B "11"
  287.   return
  288. @Label 114
  289.   SetVar B "12"
  290.   return
  291. @Label 115
  292.   SetVar B "51"
  293.   return
  294. @Label 116
  295.   SetVar B "52"
  296.   return
  297. @Label 117
  298.   SetVar B "16"
  299.   return
  300. @Label 118
  301.   SetVar B "17"
  302.   return
  303.